package com.itheima.test17;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Set;

public class test17 {
    public static void main(String[] args) {
        HashMap<String,ArrayList> hs = new HashMap<>();
        String s1 = "三国演义";
        ArrayList<String> sgyy = new ArrayList<>();
        sgyy.add("诸葛亮");
        sgyy.add("赵云");
        hs.put(s1, sgyy);

        String s2 = "西游记";
        ArrayList<String> xyj = new ArrayList<>();
        xyj.add("唐僧");
        xyj.add("孙悟空");
        hs.put(s2, xyj);

        String s3 = "水浒传";
        ArrayList<String> shz = new ArrayList<>();
        shz.add("武松");
        shz.add("鲁智深");
        hs.put(s3, shz);

        Set<String> keys = hs.keySet();
        for (String key : keys) {
            ArrayList<String> list = hs.get(key);
            System.out.println(key);
            System.out.print("\t\t");
            int count = 0;
            for (int i = 0; i < list.size(); i++) {
                count++;
                String value = list.get(i);
                if (i == list.size() - 1) {
                    System.out.println(value);
                } else {
                    System.out.print(value + "");
                }
                if (count % 1 == 0 && count != list.size()) {
                    System.out.println();
                    System.out.print("\t\t");
                }
            }
        }
    }
}
